package com.zp.self.module.date;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;

/**
 * @author ：by peng.zeng
 * @date ：Created 2021/11/5 16:33
 * @description ：
 */
public class DateUtil {
    public static void main(String[] args) {
        LocalDate today = LocalDate.now();
        int dayOfMonth = today.getDayOfMonth();
        LocalDate localDate = today.minusDays(dayOfMonth);
        String end = localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        System.out.println(end);

        //start
        LocalDate of = LocalDate.of(localDate.getYear(), localDate.getMonth(), 1);
        String start = of.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        System.out.println(start);


        //
        LocalDate today2 = LocalDate.now();
        LocalDate localDate2 = today2.minusDays(today2.getDayOfMonth());
        String time = localDate.format(DateTimeFormatter.ofPattern("yyyyMM"));
        System.out.println(time);
    }
}
